home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / calc / calc.doc < prev    next >
Encoding:
Text File  |  1994-08-02  |  2.0 KB  |  64 lines

  1. Calc is a Reverse-Polish-Notation (RPN) calculator.  You
  2. must enter the operands first, then the operation.  For
  3. example, to add 3 and 4, press [3] [Enter] [4] [+].  If
  4. the operation is unary, like sine, it operates on the bottom
  5. element of the display.  To take the sine of .54, do:
  6.  
  7. [.] [5] [4] [Sin].
  8.  
  9. The last 6 entries of the stack are visible, and you can
  10. scroll to see the rest.  All operations are performed on
  11. the element(s) at the bottom of the stack.  The bottom
  12. element is called 'x' and the next element up is called 'y'.
  13.  
  14. The [+/-] key changes the sign of x.  To find the cosine of
  15. -.22, do:
  16.  
  17. [.] [2] [2] [+/-] [Cos].
  18.  
  19. The [Inv] key changes the operation of some of the other keys
  20. so they perform the inverse operation.  It is only active for
  21. one keystroke.  Press [Inv] again to cancel the operation.
  22.  
  23. [Sto] and [Rcl] stores and recalls a single value.
  24.  
  25. [Dup2] duplicates the bottom 2 items on the stack.
  26.  
  27. [Roll] rolls all the stack elements down one, and puts the
  28. bottom element on the top.
  29.  
  30. [Exch] swaps the bottom two elements.
  31.  
  32. [Int] gives the integer part.
  33.  
  34. [Inv] [Frac] gives the fractional part.
  35.  
  36. [Clr] clears the bottom element to zero.  Use this when you
  37. get some kind of error.
  38.  
  39. [B10] and [B16] put you in base 10 or base 16 mode.  Numbers
  40. with fractional parts are always displayed in base 10.  In
  41. base 16 mode, the keys [a] through [f] are used for numeric
  42. entry.  They do nothing, otherwise.
  43.  
  44. [And], [Or] and [Not] are logical operations on 32 bit
  45. integers.  If there's a fractional part, they don't do
  46. anything.
  47.  
  48. To remember a sequence of keystrokes, press [Prog], then the
  49. sequence of keystrokes, and then [Prog] again.  For example,
  50. if you want to calculate x^2 + y^2 repeatedly, where x and y
  51. are the two bottom entries of the stack, do this:
  52.  
  53. [Prog] [Inv] [x^2] [Exch] [Inv] [x^2] [+] [Prog].
  54.  
  55. Then, to calculate 5^2+7^2, do this:
  56.  
  57. [5] [Enter] [7] [Run].
  58.  
  59. The following keys from the computer keyboard are understood
  60. by calc:
  61.  
  62. [0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [.],
  63. [Enter], [+], [-], [*], [/], [a], [b], [c], [d], [e], [f].
  64.